import { defHttp } from '@/utils/http/axios';
import { AddMembershipTitle, AddMembershipTitleGroup, EditMembershipTitle, EditMembershipTitleGroup, MembershipTitle, MembershipTitleGroup, UpdMembershipTitleStatus } from './type';
import { BasicFetchResult } from '@/api/model/baseModel';



enum Api {
    getMembershipTitleList = '/admin/custom/member/position/list',
    addMembershipTitle = '/admin/custom/member/position/add',
    editMembershipTitle = '/admin/custom/member/position/update',
    updMembershipTitleStatus = '/admin/custom/member/position/enable',
    delMembershipTitle = '/admin/custom/member/position/del',

    getMembershipTitleGroup = '/admin/custom/member/position/group/list',
    addMembershipTitleGroup = '/admin/custom/member/position/group/add',
    editMembershipTitleGroup = '/admin/custom/member/position/group/update',
    delMembershipTitleGroup = '/admin/custom/member/position/group/del'
}

/**
 * @description 查询会员职务
 * @date
 * @export
 * @param
 */
export function getMembershipTitleList(params: any) {
    return defHttp.get<MembershipTitle[]>({
        url: Api.getMembershipTitleList,
        params
    });
}

/**
 * 新增会员职务
 * @param data 
 * @returns 
 */
export function addMembershipTitle(data: AddMembershipTitle) {
    return defHttp.post({
        url: Api.addMembershipTitle,
        data
    });
}

/**
 * 修改职务类别
 * @param data 
 * @returns 
 */
export function editMembershipTitle(data: EditMembershipTitle) {
    return defHttp.post({
        url: Api.editMembershipTitle,
        data
    });
}

/**
 * 会员职务禁用启用状态初始值开启关闭
 * @param data 
 * @returns 
 */
export function updMembershipTitleStatus(data: UpdMembershipTitleStatus) {
    return defHttp.post({ url: `${Api.updMembershipTitleStatus}`, data });
}

/**
 * 删除职务类别
 * @param data 
 * @returns 
 */
export function delMembershipTitle(id: number) {
    return defHttp.post({ url: Api.delMembershipTitle + '/' + id });
}


/**
 * @description 查询单职务类别分组列表
 * @date
 * @export
 * @param
 */
export function getMembershipTitleGroup(params: any) {
    return defHttp.get<BasicFetchResult<MembershipTitleGroup>>({
        url: Api.getMembershipTitleGroup,
        params
    });
}

/**
 * 新增职务类别分组
 * @param data 
 * @returns 
 */
export function addMembershipTitleGroup(data: AddMembershipTitleGroup) {
    return defHttp.post({
        url: Api.addMembershipTitleGroup,
        data
    });
}

/**
 * 修改职务类别分组
 * @param data 
 * @returns 
 */
export function editMembershipTitleGroup(data: EditMembershipTitleGroup) {
    return defHttp.post({
        url: Api.editMembershipTitleGroup,
        data
    });
}

/**
 * 删除职务类别分组
 * @param data 
 * @returns 
 */
export function delMembershipTitleGroup(id: number) {
    return defHttp.post({ url: Api.delMembershipTitleGroup + '/' + id });
}